<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>for循环</title>
    <script>
        //求和0~100
        let sum = 0;
        for (let i = 0; i <= 100; i++) {
            sum += i;
        }
        console.log(sum);
        //1~100能被3或7整除的数字
        // for (let i = 1; i <= 100; i++) {
        //     if (i % 3 == 0 || i % 7 == 0) {
        //         console.log(i);
        //     }
        // }
        //1~100能被3和7整除的数字
        console.log("1~100能被3和7整除的数字")
        for (let i = 1; i <= 100; i++) {
            if (i % 3 == 0 && i % 7 == 0) {
                console.log(i);
            }
        }

        document.write("<ul>")
        for (let i = 1; i <= 10; i++) {
            //document.write("<li>" + i + "</li>")
            document.write(`<li>${i}</li>`);
        }
        document.write("</ul>")

        document.write("<table border=1>")
        for (let i = 1; i <= 3; i++) {
            document.write("<tr>")
            for (let j = 1; j <= 4; j++) {
                document.write(`<td>1</td>`);
            }
            document.write("</tr>")
        }
        document.write("</table>")
        //九九乘法表
        for (i = 1; i < 10; i++) {
            for (j = 1; j <= i; j++) {
                document.write(`${j}*${i}=${i * j}`);
                document.write("&nbsp;&nbsp;");
                if (j == 2 && (i == 3 || i == 4)) {
                    document.write("&nbsp;&nbsp;");
                }
            }
            document.write("<br>");
        }
        //
    </script>
</head>

<body>

</body>

</html>